<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zzf
  Date: 2021/1/7
  Time: 10:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <style type="text/css">
        table {
            border: 1px solid black;
            border-collapse: collapse;
            margin-left: auto;
            margin-right: auto;
        }

        table td,th {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<a href="${pageContext.request.contextPath}" style="text-align: center">首页</a>
<table>
    <c:if test="${empty requestScope.list}">
        <tr>
            <td>抱歉！没有查询到您需要的数据！</td>
        </tr>
    </c:if>
    <c:if test="${not empty requestScope.list}">
        <thead>
        <tr>
            <th>ID</th>
            <th>员工姓名</th>
            <th>社会保险号</th>
            <th>部门名称</th>
            <th>删除</th>
            <th>更新</th>
        </tr>
        </thead>
    <tbody>
    <c:forEach items="${requestScope.list}" var="emp">
        <tr>
            <td>${emp.empId}</td>
            <td>${emp.empName}</td>
            <td>${emp.ssn}</td>
            <td>${emp.department.deptName}</td>
            <td><a href="${pageContext.request.contextPath}/emp/del?id=${emp.empId}">删除</a></td>
            <td><a href="${pageContext.request.contextPath}/emp/update?id=${emp.empId}">修改</td>
        </tr>
    </c:forEach>
    </tbody>
    </c:if>
    <tr>
        <td colspan="6" style="text-align: center"><a href="${pageContext.request.contextPath}/emp/add/page">添加新员工</a></td>
    </tr>
</table>

</body>
</html>
